package org.douxiaoban.client.activity;


import android.app.Activity;
import android.os.Bundle;
import android.view.View;
 import com.mobclick.android.MobclickAgent;
 import android.view.Window;
import android.widget.LinearLayout;

//import net.youmi.android.AdManager;

 import org.douxiaoban.client.R;
import org.douxiaoban.client.adapter.MiniBlogAdapter;
import org.douxiaoban.client.adapter.MiniBlogAdapter.ClickCallback;
//import com.waps.*;
import org.douxiaoban.client.api.DoubanApi;
import org.douxiaoban.client.api.DoubanList.DoubanListType;
import org.douxiaoban.client.api.MiniBlogItemData;
import org.douxiaoban.client.api.MiniBlogList;
import org.douxiaoban.client.api.MiniBlogList.SendType;
import org.douxiaoban.client.app.App;
import org.douxiaoban.client.app.Assistant;
import org.douxiaoban.client.widget.TitleStyle;

import java.util.ArrayList;



public class MiniBlogActivity extends BaseActivity implements ClickCallback {

//	static{
//		AdManager.init(Assistant.AD_YOUMI_KEY, Assistant.AD_YOUMI_SCRET, 30, false, 0.1);
//	}
	private ArrayList<MiniBlogItemData> m_listMiniBlog;
	private MiniBlogList mMbList;
	private TitleStyle mTitle;
	@Override
	public void onCreate(Bundle bundle){
		 super.onCreate(bundle); 
		
	     requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
	     this.setContentView(R.layout.miniblog_home);
	     getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.custom_title);

        mTitle = new TitleStyle(this);
        mTitle.initTitleStyle();
        mTitle.initPageController(1,1);
        mTitle.setTitle(getString(R.string.miniblog));
       
	
		 
		 MiniBlogAdapter adapter = new MiniBlogAdapter(this);
		 View view = findViewById(R.id.miniblogView);
		 mMbList = new MiniBlogList(this, adapter, DoubanListType.CONTACTS_MINIBLOG, view, App.userId);
//		 m_editText = (EditText)findViewById(R.id.panelEdit);	
		 adapter.setListView(mMbList.getListView());
		 mMbList.refresh();
		 mTitle.initWriteMiniblog(mMbList);
	}	
	
	


	//点击回应那按钮
	@Override
	public void revBtnClick(String title, SendType type, String str) {
		mMbList.revBtnClick(title, type, str);
	}
	
	//点击头像到用户主页
	@Override
	public void avatarClick(String userName, String userId) {
		mMbList.avatarClick(userName, userId);		
	}
	
	@Override
	public void itemClick(MiniBlogItemData data) {
//		mMbList.clickEvent(data);
	}

      @Override
    protected void onResume() {
        MobclickAgent.onResume(this);
        super.onResume();    //Super Method super.onResume();
    }

    @Override
    protected void onPause() {
        MobclickAgent.onPause(this);
        super.onPause();    //Super Method super.onPause();
    }


   
}
